<?php

/*
 CI Library paginator resultset. A set of functions to help with creating paginated resultsets.
 Written by: Ciprian Dimofte - 06-03-2010
  */

class Pagina_resultset{
    public $CI;
    public $timestamp;
    
    public function __construct(){
        $this->CI =& get_instance();
        $this->timestamp = time();
    }
    
    
    public function create_set($query, $start, $query_params){
    	if(!$start){
    		$start = 0;
    	}
    	$qu = $query . " LIMIT " . $start . "," . $this->CI->settings->get_param("per_page");
    	
    	$sel = $this->CI->db->query($qu, $query_params);
    	$res = $sel->result();
    	
    	$sel_total = $this->CI->db->query($query, $query_params);
    	$num_total = $sel_total->num_rows();
    	
    	return array("result"=>$res, "total"=>$num_total);
    }
}

?>